<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Greeting</title>
</head>
<body>
<h1 th:text="'Hello, ' + ${name} + '!'"></h1>
<input type="button" value="测试" onclick="test()">
<script>
    function test(){
        let ws = new WebSocket("ws://localhost:8082/chat");
        ws.onopen = function(){
            console.log("===onopen===");
        }
        ws.onmessage = function(evt){
            console.log("===onmessage===");
            console.log("===evt===",evt);
        }
        ws.onclose = function(){
            console.log("===onclose===");
        }
    }
</script>
</body>
</html>